package com.neusoft.bizcore.activiti.config;

import java.util.ArrayList;
import java.util.List;

import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.neusoft.bizcore.activiti.listener.ProcessEventListener;

@Component
public class ActivitiListenerConfig implements ProcessEngineConfigurationConfigurer {

    @Autowired
    private ProcessEventListener processEventListener;

    @Override
    public void configure(final SpringProcessEngineConfiguration processEngineConfiguration) {
        final List<ActivitiEventListener> activitiEventListener = new ArrayList<>();
        activitiEventListener.add(this.processEventListener);//配置全局监听器
        processEngineConfiguration.setEventListeners(activitiEventListener);
    }

}
